package com.itcanteen.medical.patient.service.impl;

import com.itcanteen.medical.patient.entity.Theme;
import com.itcanteen.medical.patient.mapper.ThemeMapper;
import com.itcanteen.medical.patient.service.ThemeService;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 @author WangZhuoRan */
@Service
public class ThemeServiceImpl implements ThemeService {

    @Resource
    private ThemeMapper themeMapper;

    /**
     * 创建/回复主题
     * @author 1804A-TeamOne
     * @date 2020-12-17 16:29
     * @param theme 主题信息
     * @return com.itcanteen.medical.patient.entity.Theme
     */
    @Override
    public Theme createTheme (Theme theme) {
        themeMapper.save(theme);
        return theme;
    }

    /**
     * 根据主题的父id查询主题
     * @author 1804A-TeamOne
     * @date 2020-12-17 16:29
     * @param parentId 父id
     * @return com.itcanteen.medical.patient.entity.Theme
     */
    @Override
    public Theme selectById (Integer parentId) {
        return themeMapper.selectById(parentId);
    }

    /**
     * 根据关键字查询 按更新时间倒序排序
     * @author 1804A-TeamOne
     * @date 2020-12-17 16:29
     * @param keyword 关键字
     * @return java.util.List<com.itcanteen.medical.patient.entity.Theme>
     */
    @Override
    public List<Theme> selectThemeByKeywordOrderBy (String keyword) {
        return themeMapper.selectByKeywordOrderBy(keyword);
    }

    /**
     * 更新时间
     * @author 1804A-TeamOne
     * @date 2020-12-17 16:30
     * @param theme 主题信息
     */
    @Override
    public void updateTime(Theme theme) {
        themeMapper.updateTime(theme);
    }

}
